#!/NODEJS2/bin/bash

su -s - iojs <<'EOF'

export PATH=/NODEJS/bin:$PATH
export HOME={{ home }}/{{ server_user }}
export NODE_COMMON_PIPE="$HOME/test.pipe"
export NODE_TEST_DIR="$HOME/tmp"
export JOBS="{{ server_jobs | default(ansible_processor_vcpus) }}"
export OSTYPE=zos

export _BPXK_AUTOCVT=ON
export _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
export _TAG_REDIR_ERR=txt
export _TAG_REDIR_IN=txt
export _TAG_REDIR_OUT=txt

export GIT_SSL_CAINFO="{{ home }}/{{ server_user }}/ca-bundle.crt"
export SSL_CERT_FILE="{{ home }}/{{ server_user }}/ca-bundle.crt"

export CC=/bin/xlc
export LINK=/bin/xlc
export CFLAGS="-q64"
export LDFLAGS="-q64"

{{ java_path[os] }} -Dfile.encoding=ISO8859_1 -Xmx{{ server_ram|default('128m') }} \
    -jar {{ home }}/{{ server_user }}/slave.jar -secret {{ secret }} \
    -jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/slave-agent.jnlp >{{ home }}/{{ server_user }}/jenkins.log 2>&1  &
EOF
